package org.javaboy.provider.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@Controller
public class ProviderController {

    @Value(value = "${server.port}")
    Integer port;

    @Value(value = "${provider.version}")
    String version;

    private static final Logger logger = LoggerFactory.getLogger(ProviderController.class);


    @GetMapping("/hello")
    @ResponseBody
    public String hello() {
        logger.info("hello provider");
        return "hello>>>" + port + ">>>" + version;
    }

    @PostMapping("/hello2")
    public String hello2() {
        return "redirect:/hello3";
    }
}
